const { mongoose } = require('./db')

const Schema = mongoose.Schema

const PrePaySchema = new Schema({
    relation: String,
    username: String,
    bank: String,
    amount: Number,
    collect: {
        type: Date,
        default: new Date()
    },
    gender: String,
    handle: String,
    remarks: String,
}, { versionKey: false })
const prepayModel = mongoose.model('prepay', PrePaySchema, 'prepay')

const CollectSchema = new Schema({
    num: String,
    username: String,
    receivableAmount:Number,
    receivableDate:{
        type: Date,
        default: new Date()
    },
    sale:String,
    make:String,
    relation:String,
})
const collectModel = mongoose.model('collect',CollectSchema,'collect')



// prepayModel.create([
// {
//     relation: '测试',
//     username: '张三',
//     bank:'建设银行',
//     amount:2000,
//     handle:'张研',
//      gender:'不开发票',
//      remarks:'备注1'
// },
// {
//     relation: '测试',
//     username: '张三',
//     bank:'建设银行',
//     amount:2000,

//     handle:'张研',
//      gender:'销售时开发票',
//      remarks:'备注1'
// }
// ])


// collectModel.create([{
//     number:'0CSK2021030006',
//     username:'大同首钢冷轧蒋板',
//     receivableAmount: 5200,
//     sale:"肖站",
//     make:"张妍",
//     relation:'关联测试'
// }])
module.exports ={prepayModel,collectModel}
